/**
 *
 */
package com.bsoft.gol.hbs.dao;

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.spring.boot.annotation.SsdevDao;
import ctd.util.annotation.RpcService;
import hc.message.entity.MsgTplInfo;
import java.util.List;

/**
 * @since 2018-03-01 09:38:02
 */
@SsdevDao(serviceId = "tplInfoService")
public abstract class TplInfoDAO extends ctd.persistence.support.hibernate.HibernateSupportDelegateDAO<MsgTplInfo> {

    public TplInfoDAO() {
        this.setKeyField("tplId");
    }

    @RpcService
    @DAOMethod(sql = "from MsgTplInfo where tplId=:tplId")
    public abstract MsgTplInfo getTplInfoById(@DAOParam("tplId") Integer tplId);

    @RpcService
    @DAOMethod(sql = "from MsgTplInfo where tplCode=:tplCode")
    public abstract MsgTplInfo getTplInfoByTplCode(@DAOParam("tplCode") String tplCode);

    @RpcService
    @DAOMethod(sql = "from MsgTplInfo")
    public abstract List<MsgTplInfo> findTplInfos();

    @RpcService
    @DAOMethod(sql = "from MsgTplInfo where groupId = :groupId and status = :status")
    public abstract List<MsgTplInfo> findTplInfoByGroupId(@DAOParam("groupId") Integer groupId, @DAOParam("status") byte status);

    @RpcService
    @DAOMethod(sql = "select count(1) from MsgTplInfo where groupId = :groupId and status = :status")
    public abstract Long getTplInfoByGroupIdCount(@DAOParam("groupId") Integer groupId, @DAOParam("status") byte status);

    @RpcService
    @DAOMethod(sql = "update MsgTplInfo set status = :status where tplId = :tplId")
    public abstract void updateTplInfoStatus(@DAOParam("status") byte status, @DAOParam("tplId") Integer tplId);

    @RpcService
    public void saveMsgTplInfo(MsgTplInfo msgTplInfo) {
        this.save(msgTplInfo);
    }

    @RpcService
    public void updateMsgTplInfo(MsgTplInfo msgTplInfo) {
        this.update(msgTplInfo);
    }

    @RpcService
    public void deleteMsgTplInfo(Integer msgTplInfoId) {
        this.remove(msgTplInfoId);
    }
}